<template>
    <div id="OrdersTitle">
        <v-details :inputConfig="inputConfig" :detailData="inputData" :rules="rules" ref="input"></v-details>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {
                rules: {
                    activity_id: [
                        {required: true, trigger: 'blur'},
                    ]
                },
                addflag: false,
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "input",
                            label: this.$t('bill.activity'),
                            disabled: this.addflag,
                            props: "activity_id",
                        },
                        {
                            type: "input",
                            label: this.$t('bill.activityDesc'),
                            disabled: false,
                            props: "activity_desc",
                        },
                        {
                            type: "select",
                            label: this.$t('bill.activityType'),
                            disabled: false,
                            props: "activity_type",
                            options: this.getOptions("getSelectCode/ACTIVITY_TYPE/ACTIVITY_TYPE_DESC/BIC_ACTIVITY_TYPE/1=1")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.invoiceType'),
                            disabled: false,
                            props: "invoice_type",
                            options: this.getOptions("getSelectCode/INVOICE_TYPE/INV_TYPE_DESC/BIC_CODE_INVTYPE/language='zh'")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.wareHouse'),
                            disabled: this.addflag,
                            props: "facility_id",
                            options: this.getOptions("getSelectCode/FACILITY_ID/NAME/BIC_FACILITY/1=1")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.systemActivity'),
                            disabled: false,
                            props: "system_activity",
                            options: this.getOptions("getSelectCode/SYSTEM_ACTIVITY/SYSTEM_ACTIVITY/BIC_CODE_SYSACT/language='zh'")
                        },
                    ],
                ]
            }
        },
        methods: {},
        mounted() {
            if (Object.keys(this.$store.state.skip).length!==0) {
                let data = this.$store.state.skip;
                this.addflag = data.newFlag;
            } else if (!this.$store.state.newFlag) {
                this.addflag = true;
            }
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
